package cn.bmbanjia.zebra2024.apps.clewAndroid.user.controller;

import cn.bmbanjia.zebra2024.apps.clewAndroid.satoken.ClewAndroidCurrentUser;
import cn.bmbanjia.zebra2024.apps.clewAndroid.satoken.StpClewAndroidUtil;
import cn.bmbanjia.zebra2024.apps.clewAndroid.user.req.ClewAndroidUserLoginReq;
import cn.bmbanjia.zebra2024.frame.resp.Resp;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/clewAndroid/user")
@Tag(name = "线索用户")
public class ClewAndroidUserController {

    @Operation(summary = "login")
    @PostMapping("/login")
    public Resp<Void> login(@RequestBody @Valid ClewAndroidUserLoginReq req) {
        ClewAndroidCurrentUser cacu = ClewAndroidCurrentUser.builder()
                .userId(req.getUserId())
                .userName(req.getUserName())
                .build();
        StpClewAndroidUtil.login(cacu);
        return Resp.success();
    }

}
